﻿using GN.Pay.TradeChannel.YJPay.Request;
using GN.Pay.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace GN.Pay.TradeChannel.YJPay
{
    [Serializable]
    public abstract class APayRequest : AServiceRequest
    {

        /// <summary>
        /// 交易外部参数
        /// </summary>
        public string tradeInfo { get; set; }

        /// <summary>
        /// 生成签名参数
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        protected string BuildSignUrlLinkParam(ITradeChannel channel,
            YJPayConfigure config)
        {
            var dic = this.BuildSignDictionary(channel, config);
            var param = dic.UrlLinkString(k =>
            {
                return k;
            }, v =>
            {
                return HttpUtility.UrlEncode(v, config.Encoding);
            });
            dic.Clear();
            return param;
        }
    }

    public partial class tradeInfos
    {
        /// <summary>
        /// 单笔交易外部订单号字符串(1-64) 单笔交易外部订单号
        /// </summary>
        public string merchOrderNo { get; set; }

        /// <summary>
        /// 交易金额money类型 交易金额
        /// </summary>
        public decimal tradeAmount { get; set; }

        /// <summary>
        /// 交易币种字符串交易币种 CNY
        /// </summary>
        public string currency { get; set; }

        /// <summary>
        /// 商品名字符串(0-64)商品名称
        /// </summary>
        public string goodsName { get; set; }

        /// <summary>
        /// 卖家ID
        /// </summary>
        public string sellerUserId { get; set; }
    }


}
